package czh.cocoa.ui.impl;

import czh.cocoa.foundation.NSObject;
import czh.cocoa.foundation.NSSelector;
import czh.cocoa.foundation.NSString;
import czh.cocoa.ui.UIImage;

public class UIBarButtonItem extends UIBarItem {
	
	public final static int UIBarButtonItemStylePlain = 0;
	public final static int UIBarButtonItemStyleBordered = 1;
	public final static int UIBarButtonItemStyleDone = 2;
	
	public final static int UIBarButtonSystemItemNone = -1;
	public final static int UIBarButtonSystemItemFlexibleSpace = 5;
	public final static int UIBarButtonSystemItemFixedSpace = 6;
	
	private int mStyle;
	
	private NSObject mTarget;
	
	private NSSelector mAction;
	
	private float mWidth;
	
	private int mSystemItem;
	
	public UIBarButtonItem() {
		
	}
	
	public UIBarButtonItem(NSString title, int style, NSObject target, NSSelector action) {
		setTitle(title);
		mStyle = style;
		mTarget = target;
		mAction = action;
	}
	
	public UIBarButtonItem(UIImage image, int style, NSObject target, NSSelector action) {
		setImage(image);
		mStyle = style;
		mTarget = target;
		mAction = action;
	}
	
	public UIBarButtonItem(int systemItem, NSObject target, NSSelector action) {
		mSystemItem = systemItem;
		mTarget = target;
		mAction = action;
	}
	
	protected void init() {
		super.init();
		mSystemItem = UIBarButtonSystemItemNone;
	}
	
	public void setStyle(int style) {
		mStyle = style;
	}
	
	public int style() {
		return mStyle;
	}
	
	public void setTarget(NSObject target) {
		mTarget = target;
	}
	
	public NSObject target() {
		return mTarget;
	}
	
	public void setAction(NSSelector action) {
		mAction = action;
	}
	
	public NSSelector action() {
		return mAction;
	}
	
	public void setWidth(float width) {
		mWidth = width;
	}
	
	public float width() {
		return mWidth;
	}
	
	public int systemItem() {
		return mSystemItem;
	}
	
}
